<template>
  <div class="container">
    <!-- 顶部导航  -->
    <header-nav></header-nav>
    <!-- 路由视图 -->
    <div class="main" :style="styleMain">
      <transition name="fade">
        <template v-if="$route.meta.keepAlive">
          <keep-alive>
            <router-view/>
          </keep-alive>
        </template>
        <template v-else>
          <router-view/>
        </template>
      </transition>
    </div>
    <!-- 底部导航	 -->
    <footer-nav></footer-nav>
  </div>
</template>

<script>
import FooterNav from "@/components/FooterNav.vue";
import HeaderNav from "@/components/HeaderNav.vue";

export default {
  data() {
    return {};
  },
  watch: {},
  methods: {},
  components: {
    "footer-nav": FooterNav,
    "header-nav": HeaderNav,
  },
  computed: {
    styleMain() {
      if (this.$isMobile())
        return ""
      else
        return "padding-top: 46px;"
    }
  }
};
</script>

<style lang="less">
.fade-enter {
  opacity: 0;
  transform: translateX(100%);
}

.fade-leave-to {
  opacity: 0;
  transform: translateX(-100%);
  position: absolute;
}

.fade-enter-active,
.fade-leave-active {
  transition: all 0.5s ease;
}

.main {
  // padding-top: 46px;
  padding-bottom: 50px;
  background-color: white;
}
</style>
